Attribute VB_Name = "Module2"
Option Explicit

Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As Long
Private Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long

Public Sub AddBitmapsMenu(ByVal Form As Object, ByVal MenuID As Integer, ByVal SubMenu As Integer, ByVal BitmapUnchecked As Long, Optional ByVal BitmapChecked As Long)

    On Error Resume Next
    
    Dim hMenu, hSubMenu, hMenuID, x
    
    hMenu = GetMenu(Form.hWnd)
    hSubMenu = GetSubMenu(hMenu, MenuID)
    hMenuID = GetMenuItemID(hSubMenu, SubMenu)
    x = SetMenuItemBitmaps(hMenu, hMenuID, 0, BitmapUnchecked, BitmapChecked)
      
End Sub
